package com.ruoyi;

import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Date;

public class TestSyncOracle {
    public static void main(String[] args) {


        String url = "jdbc:oracle:thin:@localhost:1521/orcl";//TNSName方式
//		url = "jdbc:oracle:thin:@//10.168.107.132:1521/IPMP1";//SERVICE_NAME方式
//		url = "jdbc:oracle:thin:@10.168.107.132:1521:ipmp1";//SID方式
//      url = "jdbc:oracle:oci8:@IPMP1";//ocijdbc方式
        String user = "system";
        String password = "Zhao1990";

        System.out.println(1111);
            try{
                Connection conn = null;
                String driverClass = "oracle.jdbc.driver.OracleDriver";
                System.out.println(222);
                Class.forName(driverClass);
                conn = DriverManager.getConnection(url, user, password);
                // 创建Statement对象
                System.out.println(333);
                Statement stmt = conn.createStatement();

                // 执行查询
                ResultSet rs = stmt.executeQuery("SELECT * FROM hr.jobs where rownum <= 2 ");

                // 处理查询结果
                while (rs.next()) {
                    // 获取并打印查询结果
                    System.out.println("rs.next1:"+rs.getObject(1));
                    System.out.println("rs.next2:"+rs.getObject(2));
                    System.out.println("rs.next3:"+rs.getObject(3));
                    System.out.println("--------------------------------------------");
                }
            }catch (Exception e){
                System.out.println("error:"+e);
                System.out.println(e.getMessage());
            }

            showFileTime();
    }

    private static void showFileTime() {
        File file = new File("F:\\picccode\\ruoyi-boot3\\ds\\src\\main\\java\\com\\ry\\day1129\\LC32.java"); // 替换为要获取修改时间的文件的路径

        long timestamp = file.lastModified();
        Date modificationTime = new Date(timestamp);

        System.out.println("文件的修改时间: " + modificationTime);
    }
}
